//
//  ParttakeCell.m
//  YunGou
//
//  Created by macbook on 16/6/3.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "ParttakeCell.h"
#import <UIImageView+WebCache.h>
#import "NSString+DateTransform.h"

@interface ParttakeCell ()
@property (weak, nonatomic) IBOutlet UIImageView *avater;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *cityLabel;
@property (weak, nonatomic) IBOutlet UILabel *numLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end

@implementation ParttakeCell

- (void)awakeFromNib {
    // Initialization code
    _avater.layer.cornerRadius = _avater.frame.size.width/2;
    _avater.clipsToBounds = YES;
}

- (void)setPartakeModel:(EnjoyRecordModel *)partakeModel{
    [_avater sd_setImageWithURL:[NSURL URLWithString:[ImageUrl stringByAppendingString:partakeModel.img]]];
    _nameLabel.text = partakeModel.username;
    _cityLabel.text = [NSString stringWithFormat:@"(%@)",partakeModel.user_city];
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"本云参与%@次",partakeModel.gonumber]];
    [str addAttribute:NSForegroundColorAttributeName value:ThemeColor range:NSMakeRange(4, str.length - 5)];
    _numLabel.attributedText = str;
    _timeLabel.text = [NSString timeTransformWithString:partakeModel.time andFormatter:@"yyyy-MM-dd HH:mm:ss"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
